package org.martyn.danbodroid.gui.activitys;

import org.martyn.danbodroid.gui.ActionBar;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

public abstract class BaseActivity extends Activity
{
	private ActionBar actionBar;
	
	public ActionBar setupActionBar()
	{
		actionBar = new ActionBar(this);

		actionBar.setHomeButtonOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				goHome();
			}
		});
		
		return actionBar;
	}
		
	public void goHome() {
		if (this instanceof HomeActivity) {
		    return;
		}
		
		Intent intent = new Intent(this, HomeActivity.class);
		intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		this.startActivity(intent);
	}
	
	public ActionBar getActionBar()
	{
		return this.actionBar;
	}
	
}
